From: Sebastian Keller Date: Wed, 17 May 2023 20:49:34 +0000 (+0200) Subject: popupMenu: Use correct padding for items with hidden ornaments X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~337^2~1^2~77 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ad34082fd1e046f40b10415c4ee5a931d0513c3e;p=gnome-shell.git popupMenu: Use correct padding for items with hidden ornaments This also restores the padding adjustments that were erroneously removed in a0fde0ee, but now they only apply to ornamented items. Part-of: --- diff --git a/data/theme/gnome-shell-sass/widgets/_popovers.scss b/data/theme/gnome-shell-sass/widgets/_popovers.scss index 92588f287..a6ed06d3a 100644 --- a/data/theme/gnome-shell-sass/widgets/_popovers.scss +++ b/data/theme/gnome-shell-sass/widgets/_popovers.scss @@ -53,6 +53,10 @@ $submenu_bg_color: lighten($menu_bg_color, 7%); } } +.popup-ornamented-menu-item { + &:ltr {padding-left: $base_padding;} + &:rtl {padding-right: $base_padding;} +} // all other graphical elements (sliders) .popup-inactive-menu-item { diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 547ce08f4..9033c9044 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -94,9 +94,9 @@ var PopupBaseMenuItem = GObject.registerClass({ }); this._delegate = this; - this._ornament = Ornament.NONE; this._ornamentIcon = new St.Icon({style_class: 'popup-menu-ornament'}); this.add(this._ornamentIcon); + this.setOrnament(Ornament.NONE); this._parent = null; this._active = false; @@ -256,6 +256,14 @@ var PopupBaseMenuItem = GObject.registerClass({ } this._ornamentIcon.visible = ornament !== Ornament.HIDDEN; + this._updateOrnamentStyle(); + } + + _updateOrnamentStyle() { + if (this._ornament !== Ornament.HIDDEN) + this.add_style_class_name('popup-ornamented-menu-item'); + else + this.remove_style_class_name('popup-ornamented-menu-item'); } });